<template>
    <rx-dialog @handOk="handleSubmit" @cancel="cancel">
        <rx-layout>
            <div slot="center">
                <a-form :form="form">
                    <a-form-item style="display:none">
                        <a-input v-decorator="['settingId']"/>
                    </a-form-item>
                    <a-form-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.calendarName','日历名称')">
                        <a-input :placeholder="i18n('form.calendarName','日历名称')" style="width: 80%"
                                 v-decorator="['calName', {rules: [{required: false, message: i18n('form.calendarName','日历名称','input')}]}]"/>
                    </a-form-item>
                    <a-form-item :labelCol="labelCol1" :wrapperCol="wrapperCol1" :label="i18n('form.default', '默认')">
                        <a-radio-group :options="plainOptions" v-model="isCommonValue" @change="onChange1"/>
                    </a-form-item>
                </a-form>
            </div>
        </rx-layout>

    </rx-dialog>
</template>
<script>
    import BpmCalSettingApi from '@/api/bpm/core/bpmCalSetting'
    import {BaseForm, RxDialog} from '@lowcode/jpaas-common-lib';

    export default {
        name: 'BpmCalSettingEdit',
        mixins: [BaseForm],
        components: {
            RxDialog
        },
        data() {
            return {
                plainOptions: [
                    {label: this.i18n('yes','是'), value: 'YES'},
                    {label: this.i18n('no','否'), value: 'NO'}],
                isCommonValue: 'YES',
            };
        },
        methods: {
            i18n(name, text, key) {
                return this.$ti18(name, text, "bpmCalSetting", key);
            },
            onChange1(e) {
                this.isCommonValue = e.target.value
            },
            onload_(data) {
                if (data && data.isCommon) {
                    this.isCommonValue = data.isCommon;
                }
            },
            get(id) {
                return BpmCalSettingApi.get(id);
            },
            save(values) {
                values.isCommon = this.isCommonValue;
                return BpmCalSettingApi.save(values);
            }

        }
    }
</script>
